#ifndef _NEPTUNER_SCUBA_H_
#define _NEPTUNER_SCUBA_H_

#include<string>
#include<vector>
#include "Scope.h"

#include "Scubserver.h"
#include "Scubwalker.h"

#include "Reader.h"
#include "Tokenizer.h"

#include "Symbolyzer.h"
#include "Funcalyzer.h"

#include "Location.h"

class Scuba
{
public:
	enum Status
	{
		eScubaDoneNone,
		eScubaDoneRead,
		eScubaDoneTokenize,
		eScubaDoneParse
	};

    Scope*						m_pxCurrentScope;
    std::vector<Scope*>			m_apxScope;
	Status						m_eStatus;

	Reader						m_xReader;
	Tokenizer					m_xTokenizer;
	Symbolyzer*					m_pxSymbolyzer;
	Funcalyzer*					m_pxFuncalyzer;
	std::vector<Scubserver*>	m_apxScubserver;

    virtual void enterScope(Scope* inScope);
    virtual void exitScope(void);

	std::string			m_sFilename;
	Location			m_xLocation;

public:
	void dive(std::string in_sFilename, bool bReadFile=true, bool bTokenize=true, bool bParse=true);
	void walk(Scubwalker& in_xScubwalker);
    void print();
    void addObserver(Scubserver* inScubserver);
	void setFilename(std::string in_sFilename, int in_nLineNumber = 1);
	
	int getNumberOfLines();
	int getNumberOfTokens();
	
    Scuba(std::string sFilename="");
    ~Scuba(void);

private:
    void feed(Token& inToken);
	void walkScope(Scubwalker& in_rxScubwalker, Scope* in_pxScope);
};

#endif
